package com.hx.miniblog.pojo.vo;

import com.hx.miniblog.pojo.SysUser;
import com.hx.miniblog.pojo.mj.RoleType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author wenhao hu
 * @title: LoginVo
 * @projectName miniBlog
 * @description: TODO
 * @date 2021/12/2811:41
 */
@Data
public class LoginVo {
    @ApiModelProperty(name = "id",value = "用户Id",dataType = "String")
    private String id;
    @ApiModelProperty(name = "userName",value = "用户名",dataType = "String")
    private String userName;
    @ApiModelProperty(name = "avatar",value = "用户头像",dataType = "String")
    private String avatar;
    @ApiModelProperty(name = "role",value = "用户角色",dataType = "String")
    private RoleType role;
    @ApiModelProperty(name = "token",value = "token",dataType = "String")
    private String token;
    public static LoginVo makeVo(SysUser sysUser,RoleType role,String token){
        LoginVo vo = new LoginVo();
        vo.setAvatar(sysUser.getUserAvatar());
        vo.setId(sysUser.getId());
        vo.setUserName(sysUser.getUserName());
        vo.setRole(role);
        vo.setToken(token);
        return vo;
    }
}
